<template>
  <div class="Property">

    <el-row :gutter="24">
      <el-col :span="18">
        <div class="hsi-pro">
          <h2 class="el-icon-s-home">地产分类 </h2>
        </div>
      </el-col>
    </el-row>
    <el-row :gutter="24">
      <el-col :span="20">
        <ul class="box">
          <li v-for="(item,key) in data" :key="key" class="box1" @click="toHomeLest(item.id)">
            <img :src="item.image" alt="" class="img-image" >
            <div class="box4">
              <h3>{{item.title}}</h3>
              <p>{{item.desc}}</p>
            </div>
            <div class="box3">
              <h3 class="p1">{{item.title}}</h3>
              <p class="p2">{{item.desc}}</p>
            </div>
            <div class="box2"></div>
          </li>
        </ul>
      </el-col>
    </el-row>

  </div>
</template>
<script >
import { getproperty } from "@/api/property";
export default {
  data() {
    return {
      data: [],
    };
  },
  async created() {
    const res = await getproperty();
    console.log(res);
    this.data = res.data;
  },
  methods:{
    toHomeLest(id){
      this.$router.push({
        path:'/HomeLest',
        query:{
          category:id
        }
      })
    }
  }
};
// 11
</script>
<style lang="scss" scoped>
* {
  padding: 0;
  margin: 0;
}
.el-icon-s-home {
  margin-top: 10px;
  color: #0511fd;
}
ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  li {
    overflow: hidden;
    position: relative;
    background-color: #fff;
    box-shadow: 2px 10px 3px #ccc;
    // box-shadow: 0 0 8px rgb(3, 80, 252);
    margin: 20px 20px;
    width: 450px;
    height: 500px;
    border-radius: 8px;
    p {
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      text-indent: 1em;
      margin: 0;
    }
    .box3 {
      transition: 1s;
      margin: 15px 15px 0;
      position: absolute;
      left: 0;
      bottom: -76px;
      z-index: 666;
      color: #fff;
    }
    .box4 {
      margin: 15px 15px 0;
    }
  }
  li:hover .box3 {
    transform: translateY(-200px);
    z-index: 666999;
  }
  li:hover .box2 {
    opacity: 1;
  }
  .box2 {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    /* 设置层级，避免被图片覆盖 */
    z-index: 1;
    /* transform: translateY(100%); 特性建议优先使用 */
    /* 第二种方法 */
    opacity: 0;
    transition: all 1s;
  }
}
.img-image {
  width: 450px;
  height: 390px;
  // height: 100%;
  border-radius: 8px;
}
.el-row {
  background-color: #eee;
  display: flex;
  justify-content: center;
  &:last-child {
    margin-bottom: 0;
  }
  // z-index: 10000;
}
.el-col {
  border-radius: 4px;
}
.bg-purple {
  background: linear-gradient(
    to right,
    #ccffdc,
    #ccffff,
    #ccf7ff,
    rgb(224, 255, 192)
  );
  display: flex;
  border: 1px solid;
  margin-bottom: 10px;
  .left {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 300px;
    // background-color: pink;
    img {
      width: 170px;
      height: 200px;
    }
    border-right: 1px solid;
  }
  .right {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    h1 {
      background-image: linear-gradient(
        to right,
        aquamarine,
        rgb(255, 0, 157),
        aqua,
        pink
      );
      -webkit-background-clip: text;
      color: transparent;
      margin-bottom: 10px;
    }
    p {
      padding: 0 10px;
    }
  }
}
i {
  display: block;
  height: 40px;
  line-height: 40px;
  font-size: 22px;
  background-image: linear-gradient(
    to right,
    rgb(255, 127, 191),
    rgb(13, 255, 0),
    rgb(30, 0, 255),
    rgb(255, 192, 213)
  );
  -webkit-background-clip: text;
  color: transparent;
}
.grid-content {
  border-radius: 50px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
</style>